package com.caocaog.market.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.caocaog.market.entity.ShopPromoHis;
import com.caocaog.market.mapper.ShopPromoHisMapper;
import com.caocaog.market.service.ShopPromoHisService;
import org.jeecg.common.exception.JeecgBootException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 商品促销历史信息
 *
 * @author chechen
 * @date 2021-11-20
 */
@Service
@Transactional
public class ShopPromoHisServiceImpl extends ServiceImpl<ShopPromoHisMapper, ShopPromoHis> implements ShopPromoHisService {

    @Override
    public IPage<ShopPromoHis> queryShopPromoHisPage(Page<ShopPromoHis> page, ShopPromoHis shopPromoHis) {
        return super.baseMapper.queryShopPromoHisPage(page, shopPromoHis);
    }

    @Override
    public String addShopPromoHis(ShopPromoHis shopPromoHis) {
        super.baseMapper.insert(shopPromoHis);
        if (shopPromoHis.getId() == null)
            throw new JeecgBootException("新增商品促销历史信息失败");
        return shopPromoHis.getId();
    }

    @Override
    public List<ShopPromoHis> selectShopPromoHisByShopId(String shopId) {
        return super.baseMapper.selectShopPromoHisByShopId(shopId);
    }

}
